<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Make Controller Kit - Firmware API: Network</title>
<link href="mt_doxygen.css" rel="stylesheet" type="text/css" />
<link href="../resources/mt_doxytabs.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.header {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12pt;
	color: #222222;
}
-->
</style>
</head>

<body>
<table width="800" border="0">
    <tr>
      <td colspan="3">
        <form method="get" action="http://www.google.com/search">
          <div align="right">
            <input type="text"   name="q" size="25"
              maxlength="255" value="" />
            <input type="submit" value="Search" />
            <input type="hidden" name="sitesearch" value="makingthings.com/ref/firmware/html" />
          </div>
        </form>
       </td>
    </tr>
    <tr>
      <td><div align="center"><a href="http://www.makingthings.com">
				<img src="../resources/logo_brown_medium.png" alt="MakingThings"
									width="200" height="78" border="0" align="middle" longdesc="http://www.makingthings.com" /></a></div></td>
				<td><div align="center" class="header">
      		Make Controller Kit <br />
          Firmware API
      </div></td>
      <td><div align="center"><a href="http://www.makezine.com">
					<img src="../resources/make_logo.png" alt="MAKE Zine" 
										width="164" height="73" border="0" align="middle" longdesc="http://www.makezine.com" /></a></div></td>
    </tr>
</table>
</body>
</html>
<!-- Generated by Doxygen 1.5.4 -->
<script type="text/javascript">
<!--
function changeDisplayState (e){
  var num=this.id.replace(/[^[0-9]/g,'');
  var button=this.firstChild;
  var sectionDiv=document.getElementById('dynsection'+num);
  if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){
    sectionDiv.style.display='block';
    button.src='open.gif';
  }else{
    sectionDiv.style.display='none';
    button.src='closed.gif';
  }
}
function initDynSections(){
  var divs=document.getElementsByTagName('div');
  var sectionCounter=1;
  for(var i=0;i<divs.length-1;i++){
    if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){
      var header=divs[i];
      var section=divs[i+1];
      var button=header.firstChild;
      if (button!='IMG'){
        divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild);
        button=document.createElement('img');
        divs[i].insertBefore(button,divs[i].firstChild);
      }
      header.style.cursor='pointer';
      header.onclick=changeDisplayState;
      header.id='dynheader'+sectionCounter;
      button.src='closed.gif';
      section.id='dynsection'+sectionCounter;
      section.style.display='none';
      section.style.marginLeft='14px';
      sectionCounter++;
    }
  }
}
window.onload = initDynSections;
-->
</script>
<div class="tabs">
  <ul>
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="modules.html"><span>Modules</span></a></li>
    <li><a href="classes.html"><span>Data&nbsp;Structures</span></a></li>
    <li><a href="files.html"><span>Files</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
  </ul>
</div>
<h1>Network<br>
<small>
[<a class="el" href="group___controller.html">Controller</a>]</small>
</h1>The Network subsystem manages the Ethernet controller.  
<a href="#_details">More...</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___network.html#g0989090dd4929827de8708269f808e5b">Network_SetActive</a> (int state)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets whether the Network subsystem is active.  <a href="#g0989090dd4929827de8708269f808e5b"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___network.html#gb1f4725187ab9011d327ed8e05e4746c">Network_GetActive</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the active state of the Network subsystem.  <a href="#gb1f4725187ab9011d327ed8e05e4746c"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___network.html#g8efe3e0915b89c461da231653b7bd3b7">Network_SetAddress</a> (int a0, int a1, int a2, int a3)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the IP address of the Make Controller.  <a href="#g8efe3e0915b89c461da231653b7bd3b7"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___network.html#g8f1c006937cf5985de44cf8cd0751642">Network_SetMask</a> (int a0, int a1, int a2, int a3)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the network mask of the Make Controller on your local network.  <a href="#g8f1c006937cf5985de44cf8cd0751642"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___network.html#g1a5be7ffdac1a43d83f6c84369d0bb55">Network_SetGateway</a> (int a0, int a1, int a2, int a3)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the gateway address for the local network the Make Controller is on.  <a href="#g1a5be7ffdac1a43d83f6c84369d0bb55"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___network.html#gf5c24462c4ca5bfcf8a9ffdb80c290d8">Network_GetAddress</a> (int *a0, int *a1, int *a2, int *a3)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Read the board's current IP address.  <a href="#gf5c24462c4ca5bfcf8a9ffdb80c290d8"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___network.html#ga0837a01a5bd814cae2a080f8b2bf86b">Network_GetMask</a> (int *a0, int *a1, int *a2, int *a3)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Read the board's current network mask.  <a href="#ga0837a01a5bd814cae2a080f8b2bf86b"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___network.html#ge91ce5f124fcfbabc529d75fc222d49e">Network_GetGateway</a> (int *a0, int *a1, int *a2, int *a3)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Read the board's current gateway address.  <a href="#ge91ce5f124fcfbabc529d75fc222d49e"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___network.html#gc61ff10637ea2e5a44c4af330693e9e0">Network_SetDhcpEnabled</a> (int enabled)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set whether DHCP is enabled.  <a href="#gc61ff10637ea2e5a44c4af330693e9e0"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___network.html#ge24b6f9eecab6b6339bfc19524ff3f60">Network_GetDhcpEnabled</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Read whether DHCP is currently enabled.  <a href="#ge24b6f9eecab6b6339bfc19524ff3f60"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___network.html#g8e37b3166ad4cafc5261e3de373e9261">Network_SetWebServerEnabled</a> (int state)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set whether the demo webserver is enabled.  <a href="#g8e37b3166ad4cafc5261e3de373e9261"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___network.html#g371af21b1030735315a0c101aee27ace">Network_GetWebServerEnabled</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Read whether the demo webserver is enabled.  <a href="#g371af21b1030735315a0c101aee27ace"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
The Network subsystem manages the Ethernet controller. 
<p>
Like any other network enabled device, the Make Controller has an IP address, net mask and gateway.<ul>
<li>The default IP address is 192.168.0.200</li><li>The default mask is 255.255.255.0</li><li>The default gateway 192.168.0.1</li></ul>
<p>
You can set any of these values manually, or use DHCP to get them automatically.<h2><a class="anchor" name="MAC">
MAC</a></h2>
The Make Controller's MAC address defaults to AC.DE.48.55.x.y where x &amp; y are calculated from the unit's serial number, handled by the <a class="el" href="group___system.html">System</a> subsystem.<h2><a class="anchor" name="webserver">
Web Server</a></h2>
The Make Controller Kit can also act as a web server. The demo web server running on the Make Controller displays some stats about the board's current state through a web interface. It is intended mainly as a starting point for more useful web applications. See the source in <a class="el" href="webserver_8c.html" title="Functions for implementing a WebServer on the Make Controller Board.">webserver.c</a>. <hr><h2>Function Documentation</h2>
<a class="anchor" name="gb1f4725187ab9011d327ed8e05e4746c"></a><!-- doxytag: member="network.c::Network_GetActive" ref="gb1f4725187ab9011d327ed8e05e4746c" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Network_GetActive           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the active state of the Network subsystem. 
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>State - 1 (active) or 0 (inactive). </dd></dl>

<p>Definition at line <a class="el" href="network_8c-source.html#l00598">598</a> of file <a class="el" href="network_8c-source.html">network.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="gf5c24462c4ca5bfcf8a9ffdb80c290d8"></a><!-- doxytag: member="network.c::Network_GetAddress" ref="gf5c24462c4ca5bfcf8a9ffdb80c290d8" args="(int *a0, int *a1, int *a2, int *a3)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Network_GetAddress           </td>
          <td>(</td>
          <td class="paramtype">int *&nbsp;</td>
          <td class="paramname"> <em>a0</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&nbsp;</td>
          <td class="paramname"> <em>a1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&nbsp;</td>
          <td class="paramname"> <em>a2</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&nbsp;</td>
          <td class="paramname"> <em>a3</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Read the board's current IP address. 
<p>
Pass in pointers to integers where the address should be stored.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>a0</em>&nbsp;</td><td>A pointer to an integer where the first of 4 numbers of the address is to be stored. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>a1</em>&nbsp;</td><td>A pointer to an integer where the second of 4 numbers of the address is to be stored. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>a2</em>&nbsp;</td><td>A pointer to an integer where the third of 4 numbers of the address is to be stored. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>a3</em>&nbsp;</td><td>A pointer to an integer where the fourth of 4 numbers of the address is to be stored. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success.</dd></dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  <span class="keywordtype">int</span> a0, a1, a2, a3;
  <a class="code" href="group___network.html#gf5c24462c4ca5bfcf8a9ffdb80c290d8" title="Read the board&amp;#39;s current IP address.">Network_GetAddress</a>( &amp;a0, &amp;a1, &amp;a2, &amp;a3 );
  <span class="comment">// now our variables are filled with the current address values</span>
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="network_8c-source.html#l00734">734</a> of file <a class="el" href="network_8c-source.html">network.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="ge24b6f9eecab6b6339bfc19524ff3f60"></a><!-- doxytag: member="network.c::Network_GetDhcpEnabled" ref="ge24b6f9eecab6b6339bfc19524ff3f60" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Network_GetDhcpEnabled           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Read whether DHCP is currently enabled. 
<p>
This value is stored presistently, so it will be the same across system reboots. <dl class="return" compact><dt><b>Returns:</b></dt><dd>An integer specifying whether DHCP is enabled - 1 (enabled) or 0 (disabled). </dd></dl>

<p>Definition at line <a class="el" href="network_8c-source.html#l00884">884</a> of file <a class="el" href="network_8c-source.html">network.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="ge91ce5f124fcfbabc529d75fc222d49e"></a><!-- doxytag: member="network.c::Network_GetGateway" ref="ge91ce5f124fcfbabc529d75fc222d49e" args="(int *a0, int *a1, int *a2, int *a3)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Network_GetGateway           </td>
          <td>(</td>
          <td class="paramtype">int *&nbsp;</td>
          <td class="paramname"> <em>a0</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&nbsp;</td>
          <td class="paramname"> <em>a1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&nbsp;</td>
          <td class="paramname"> <em>a2</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&nbsp;</td>
          <td class="paramname"> <em>a3</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Read the board's current gateway address. 
<p>
Pass in pointers to integers where the gateway address should be stored.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>a0</em>&nbsp;</td><td>A pointer to an integer where the first of 4 numbers of the gateway address is to be stored. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>a1</em>&nbsp;</td><td>A pointer to an integer where the second of 4 numbers of the gateway address is to be stored. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>a2</em>&nbsp;</td><td>A pointer to an integer where the third of 4 numbers of the gateway address is to be stored. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>a3</em>&nbsp;</td><td>A pointer to an integer where the fourth of 4 numbers of the gateway address is to be stored. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success.</dd></dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  <span class="keywordtype">int</span> a0, a1, a2, a3;
  <a class="code" href="group___network.html#ge91ce5f124fcfbabc529d75fc222d49e" title="Read the board&amp;#39;s current gateway address.">Network_GetGateway</a>( &amp;a0, &amp;a1, &amp;a2, &amp;a3 );
  <span class="comment">// now our variables are filled with the current gateway values</span>
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="network_8c-source.html#l00817">817</a> of file <a class="el" href="network_8c-source.html">network.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="ga0837a01a5bd814cae2a080f8b2bf86b"></a><!-- doxytag: member="network.c::Network_GetMask" ref="ga0837a01a5bd814cae2a080f8b2bf86b" args="(int *a0, int *a1, int *a2, int *a3)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Network_GetMask           </td>
          <td>(</td>
          <td class="paramtype">int *&nbsp;</td>
          <td class="paramname"> <em>a0</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&nbsp;</td>
          <td class="paramname"> <em>a1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&nbsp;</td>
          <td class="paramname"> <em>a2</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&nbsp;</td>
          <td class="paramname"> <em>a3</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Read the board's current network mask. 
<p>
Pass in pointers to integers where the mask should be stored.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>a0</em>&nbsp;</td><td>A pointer to an integer where the first of 4 numbers of the mask is to be stored. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>a1</em>&nbsp;</td><td>A pointer to an integer where the second of 4 numbers of the mask is to be stored. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>a2</em>&nbsp;</td><td>A pointer to an integer where the third of 4 numbers of the mask is to be stored. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>a3</em>&nbsp;</td><td>A pointer to an integer where the fourth of 4 numbers of the mask is to be stored. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success.</dd></dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  <span class="keywordtype">int</span> a0, a1, a2, a3;
  <a class="code" href="group___network.html#ga0837a01a5bd814cae2a080f8b2bf86b" title="Read the board&amp;#39;s current network mask.">Network_GetMask</a>( &amp;a0, &amp;a1, &amp;a2, &amp;a3 );
  <span class="comment">// now our variables are filled with the current mask values</span>
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="network_8c-source.html#l00776">776</a> of file <a class="el" href="network_8c-source.html">network.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g371af21b1030735315a0c101aee27ace"></a><!-- doxytag: member="network.c::Network_GetWebServerEnabled" ref="g371af21b1030735315a0c101aee27ace" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Network_GetWebServerEnabled           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Read whether the demo webserver is enabled. 
<p>
This value is stored presistently, so it will be the same across system reboots. <dl class="return" compact><dt><b>Returns:</b></dt><dd>An integer specifying whether the webserver is enabled - 1 (enabled) or 0 (disabled). </dd></dl>

<p>Definition at line <a class="el" href="network_8c-source.html#l00922">922</a> of file <a class="el" href="network_8c-source.html">network.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g0989090dd4929827de8708269f808e5b"></a><!-- doxytag: member="network.c::Network_SetActive" ref="g0989090dd4929827de8708269f808e5b" args="(int state)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Network_SetActive           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>state</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Sets whether the Network subsystem is active. 
<p>
This fires up the networking system on the Make Controller, and will not return until a network is found, ie. a network cable is plugged in. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>state</em>&nbsp;</td><td>An integer specifying the active state - 1 (active) or 0 (inactive). </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success. </dd></dl>

<p>Definition at line <a class="el" href="network_8c-source.html#l00555">555</a> of file <a class="el" href="network_8c-source.html">network.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g8efe3e0915b89c461da231653b7bd3b7"></a><!-- doxytag: member="network.c::Network_SetAddress" ref="g8efe3e0915b89c461da231653b7bd3b7" args="(int a0, int a1, int a2, int a3)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Network_SetAddress           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>a0</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>a1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>a2</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>a3</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Set the IP address of the Make Controller. 
<p>
The IP address of the Make Controller, in dotted decimal form (xxx.xxx.xxx.xxx), can be set by passing in each of the numbers as a separate parameter. The default IP address of each Make Controller as it ships from the factory is 192.168.0.200.<p>
This value is stored in EEPROM, so it persists even after the board is powered down.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>a0</em>&nbsp;</td><td>An integer corresponding to the first of 4 numbers in the address. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>a1</em>&nbsp;</td><td>An integer corresponding to the second of 4 numbers in the address. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>a2</em>&nbsp;</td><td>An integer corresponding to the third of 4 numbers in the address. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>a3</em>&nbsp;</td><td>An integer corresponding to the fourth of 4 numbers in the address. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success.</dd></dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  <span class="comment">// set the address to 192.168.0.23</span>
  <a class="code" href="group___network.html#g8efe3e0915b89c461da231653b7bd3b7" title="Set the IP address of the Make Controller.">Network_SetAddress</a>( 192, 168, 0, 23 );
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="network_8c-source.html#l00629">629</a> of file <a class="el" href="network_8c-source.html">network.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="gc61ff10637ea2e5a44c4af330693e9e0"></a><!-- doxytag: member="network.c::Network_SetDhcpEnabled" ref="gc61ff10637ea2e5a44c4af330693e9e0" args="(int enabled)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Network_SetDhcpEnabled           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>enabled</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Set whether DHCP is enabled. 
<p>
The Make Controller can use DHCP (Dynamic Host Configuration Protocol) to automatically retrieve an IP address from a router. If you're using your Make Controller on a network with a router, it is generally preferred (and more convenient) to use DHCP. Otherwise, turn DHCP off and set the IP address, mask, and gateway manually.<p>
Wikipedia has a good article about DHCP at <a href="http://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol">http://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol</a><p>
This value is stored persistently, so it will remain constant across system reboots. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>enabled</em>&nbsp;</td><td>An integer specifying whether to enable DHCP - 1 (enable) or 0 (disable). </td></tr>
  </table>
</dl>

<p>Definition at line <a class="el" href="network_8c-source.html#l00853">853</a> of file <a class="el" href="network_8c-source.html">network.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g1a5be7ffdac1a43d83f6c84369d0bb55"></a><!-- doxytag: member="network.c::Network_SetGateway" ref="g1a5be7ffdac1a43d83f6c84369d0bb55" args="(int a0, int a1, int a2, int a3)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Network_SetGateway           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>a0</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>a1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>a2</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>a3</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Set the gateway address for the local network the Make Controller is on. 
<p>
The gateway address is commonly 192.168.0.1 for many home networks. Set the gateway address in dotted decimal form (xxx.xxx.xxx.xxx), passing in each number as a separate parameter.<p>
This value is stored in EEPROM, so it persists even after the board is powered down.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>a0</em>&nbsp;</td><td>An integer corresponding to the first of 4 numbers in the gateway address. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>a1</em>&nbsp;</td><td>An integer corresponding to the second of 4 numbers in the gateway address. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>a2</em>&nbsp;</td><td>An integer corresponding to the third of 4 numbers in the gateway address. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>a3</em>&nbsp;</td><td>An integer corresponding to the fourth of 4 numbers in the gateway address. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success.</dd></dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  <span class="comment">// set the gateway to 192.168.5.1</span>
  <span class="keywordflow">if</span>( 0 != <a class="code" href="group___network.html#g1a5be7ffdac1a43d83f6c84369d0bb55" title="Set the gateway address for the local network the Make Controller is on.">Network_SetGateway</a>( 192, 168, 5, 1 ) )
    <span class="comment">// then there was a problem.</span>
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="network_8c-source.html#l00703">703</a> of file <a class="el" href="network_8c-source.html">network.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g8f1c006937cf5985de44cf8cd0751642"></a><!-- doxytag: member="network.c::Network_SetMask" ref="g8f1c006937cf5985de44cf8cd0751642" args="(int a0, int a1, int a2, int a3)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Network_SetMask           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>a0</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>a1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>a2</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>a3</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Set the network mask of the Make Controller on your local network. 
<p>
When on a subnet or local network, the network mask must be set in order for the gateway to route information to the board's IP address properly. The mask is commonly 255.255.255.0 for many home networks. Set the mask in dotted decimal form (xxx.xxx.xxx.xxx), passing in each number as a separate parameter.<p>
This value is stored in EEPROM, so it persists even after the board is powered down.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>a0</em>&nbsp;</td><td>An integer corresponding to the first of 4 numbers in the mask. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>a1</em>&nbsp;</td><td>An integer corresponding to the second of 4 numbers in the mask. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>a2</em>&nbsp;</td><td>An integer corresponding to the third of 4 numbers in the mask. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>a3</em>&nbsp;</td><td>An integer corresponding to the fourth of 4 numbers in the mask. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success.</dd></dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  <span class="comment">// set the mask to 255.255.255.254</span>
  <span class="keywordflow">if</span>( 0 != <a class="code" href="group___network.html#g8f1c006937cf5985de44cf8cd0751642" title="Set the network mask of the Make Controller on your local network.">Network_SetMask</a>( 255, 255, 255, 254 ) )
    <span class="comment">// then there was a problem.</span>
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="network_8c-source.html#l00667">667</a> of file <a class="el" href="network_8c-source.html">network.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g8e37b3166ad4cafc5261e3de373e9261"></a><!-- doxytag: member="network.c::Network_SetWebServerEnabled" ref="g8e37b3166ad4cafc5261e3de373e9261" args="(int state)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Network_SetWebServerEnabled           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>state</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Set whether the demo webserver is enabled. 
<p>
The demo webserver provides access to some of the Make Controller's stats via a standard web browser. It is intended mainly as a reference for creating web based applications.<p>
This value is stored persistently, so it will remain constant across system reboots. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>state</em>&nbsp;</td><td>An integer specifying whether to enable the webserver - 1 (enable) or 0 (disable). </td></tr>
  </table>
</dl>

<p>Definition at line <a class="el" href="network_8c-source.html#l00899">899</a> of file <a class="el" href="network_8c-source.html">network.c</a>.</p>

</div>
</div><p>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Make Controller Kit</title>
<style type="text/css">
<!--
.footer {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 9pt;
	color: #999999;
}
-->
</style>
</head>

<body>
<hr size="1">
<div>
  <p class="footer">The Make Controller Kit is an open source project maintained by <a href="http://www.makingthings.com">MakingThings</a>.<br />
    MakingThings code is released under the <a href="http://www.apache.org/licenses/LICENSE-2.0.html" target="_blank">Apache 2.0 license</a>.<br />
    Bug tracker, development wiki and status can be found at <a href="http://dev.makingthings.com">http://dev.makingthings.com</a>.<br />
		This document was last updated on 5 Dec 2007.
</p>
</div>
<!-- Google Analytics Code -->
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-769030-1";
urchinTracker();
</script>
</body>
</html>
